package com.example.testdemo.home;

import android.os.Bundle;
import android.os.PersistableBundle;
import android.support.annotation.Nullable;
import android.support.v4.app.FragmentActivity;
import android.widget.Toast;

/**
 * Created by 颜 on 05.08.008.
 * 基础Activity
 */

public abstract class BaseActivity extends FragmentActivity {
    private Toast mToast;
    protected void showToast(String content){
        if (mToast != null){
            mToast.cancel();
        }
        mToast = new Toast(this);
        mToast.setText(content);
        mToast.show();
    }


    @Override
    public void onCreate(@Nullable Bundle savedInstanceState, @Nullable PersistableBundle persistentState) {
        super.onCreate(savedInstanceState, persistentState);
        ActivityManagers.getInstance().addActivity(this);
    }

    @Override
    protected void onResume() {
        super.onResume();
    }

    @Override
    protected void onPause() {
        super.onPause();
    }

    @Override
    protected void onStop() {
        super.onStop();
    }

    @Override
    protected void onDestroy() {
        super.onDestroy();
        ActivityManagers.getInstance().finishActivity(this);
    }

}
